<!-- 列表显示头 开始 -->
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="STYLE1" bgcolor="b5d6e6">
  <tr>
    <td colspan="3" align="left" background='<%=$urr+"skin/images/bg.gif"%>'><img src='<%=$urr+"skin/icon/list.gif"%>' width="16" height="16" />
      <span class="STYLE3"><%=@titles %></span></td>
  </tr>
</table>
<!-- 列表查询项 开始 -->
<table width="100%" border="0" cellpadding="2" cellspacing="2" class="STYLE1">
  <% form_for :section, :url => { :action => "list" } do |f| %>
    <tr>
      <td height="30" align="left">
        <%= f.label "栏目名称" %>
        <%= f.text_field :name%>
        <%= f.label :channel_id,"所属频道" %>
        <%= select_tag("section[channel_id]",
          options_for_select(Channel.find(:all,:conditions => ['status = 1 and channel_type <> 3']).collect{|i| [ i.name,i.id]}.insert(0,['全部频道',nil]),
            @section.channel_id))-%>
        <%= f.submit '搜索' %>
      </td>
    </tr>
  <% end %>
</table>
<!-- 列表操作项 开始 -->
<table width="100%" border="0" cellpadding="2" cellspacing="2" class="STYLE1">
  <tr>
    <td height="30" align="right">
      <%= button_to "增加栏目", :controller => "sections",:action => "new" %>
      <%= button_to "增加专辑", :controller => "sections",:action => "new_al" %>
    </td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="b5d6e6"  class="STYLE1">
  <tr>
    <td width="15%" height="22" align="center" bgcolor="#33FFFF">栏目名称</td>
    <td height="22" align="center" bgcolor="#33FFFF">状态</td>
    <td height="22" align="center" bgcolor="#33FFFF">所属频道</td>
    <td height="22" align="center" bgcolor="#33FFFF">X坐标</td>
    <td height="22" align="center" bgcolor="#33FFFF">Y坐标</td>
    <td height="22" align="center" bgcolor="#33FFFF">级别</td>
    <td height="22" align="center" bgcolor="#33FFFF">栏目类型</td>
    <td height="22" align="center" bgcolor="#33FFFF">是否广告</td>
    <td  height="22" align="center" bgcolor="#33FFFF">广告地址</td>
    <td  height="22" align="center" bgcolor="#33FFFF">描述</td>
    <td  height="22" align="center" bgcolor="#33FFFF">操作</td>
  </tr>

  <% @sections.each_with_index do |section,index| %>
    <%
    bg_col = "#CCFFCC"
    unless index%2 == 0
      bg_col = "#FFCCCC"
    end
  %>
    <tr>
      <td align="center" bgcolor=<%= bg_col %>><%=h section.name %></td>
      <td align="center" bgcolor=<%= bg_col %>><%=h section.status %></td>
      <td align="center" bgcolor=<%= bg_col %>><%=h section.channel.name %></td>
      <td align="center" bgcolor=<%= bg_col %>><%=h section.x %></td>
      <td align="center" bgcolor=<%= bg_col %>><%=h section.y %></td>
      <td align="center" bgcolor=<%= bg_col %>><%=h section.level %></td>
      <td align="center" bgcolor=<%= bg_col %>>
        <%  if section.col_type == "1" %>
          <%= "图集" %>
        <%  elsif section.col_type == "2" %>
          <%= "图文" %>
        <% elsif section.col_type == "3" %>
          <%= "小说" %>
        <% else %>
          <%= "专辑" %>
        <% end %>
      </td>
      <td align="center" bgcolor=<%= bg_col %>><%=h section.is_ad %></td>
      <td align="center" bgcolor=<%= bg_col %>><%=h section.ad_url %></td>
      <td align="center" bgcolor=<%= bg_col %>><%=h section.desc %></td>
      <td align="center" bgcolor=<%= bg_col %>>
        <%= link_to '查看',  :controller => "sections", :action => "show", :id => section.id %>
        <%if section.col_type == "4"%>
          <%= link_to '编辑',  :controller => "sections", :action => "edit_al", :id => section.id  %>
        <%else%>
          <%= link_to '编辑',  :controller => "sections", :action => "edit", :id => section.id  %>
        <%end%>
        <%= link_to '删除',  :controller => "sections", :action => "delete", :id => section.id  %>
      </td>
    </tr>
  <% end %>
</table>

<!-- 列表分页项 开始 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr align="center">
    <td align="center" height="40">
      <%= will_paginate @sections, :style => 'font-size: small'%>
    </td>
  </tr>
</table>
<!-- 列表分页项 结束 -->